import subprocess

# 读取 requirements.txt 文件
with open('requirements.txt', 'r', encoding='utf-8') as f:
    requirements = f.readlines()

# 遍历每一行，使用 pip 安装依赖
for req in requirements:
    req = req.strip()  # 去除行首行尾的空白字符
    if req:  # 如果行不为空
        subprocess.run(['pip', 'install', req])